import {reactive} from "vue";
import {processRequest} from "@/framework";

export const useReflectionData = () => {

    const reflections = reactive<{
        projectList: any[]
        saleStaffList: any[]
    }>({
        projectList: [],
        saleStaffList: []
    })

    async function getProjectList(params?: any) {
        const result = await processRequest.get("/api/DevelopProjectList",
            {
                pageIndex: 1,
                pageSize: 99999999,
                ...params
            })
        reflections.projectList = result.dataList
    }

    async function getsaleStaffList(params?: any) {
        const result = await processRequest.get("/api/Staff",
            {
                pageIndex: 1,
                pageSize: 99999999,
                ...params
            })
        reflections.saleStaffList = result.dataList
    }

    async function getReflectionData() {
        getProjectList()
        getsaleStaffList()
    }

    return {
        getProjectList,
        reflections,
        getReflectionData
    }
}
